package homework;

import Abstract.Point;

public class Circle extends Shape{
private int r;
public Circle(){


}
public Circle(Point position, int r){
    super(position);
    this.r=r;
}
@Override
public double area(){
    return Math.PI*r*r;
}
public boolean contains(Point p){
    return this.getPosition().distance(p)<=this.r;
}
public Circle(int x,int y,int r){
    super(x,y);
    this.r=r;
}
public int getR(){
    return r;
}public  void setR(int r){
    this.r=r;
}
@Override
public boolean equals(Object obj){
    if(obj == null){
        return false;
    }
    if(this == obj){
        return true;
    }
    if(obj instanceof Shape){
        Shape shape=(Shape)obj;
        return this.getPosition().equals(shape.getPosition());


    }
    return false;
}
public int hashCode(){
    return this.getPosition().hashCode();
}
}
